{#
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
#}
{% macro render_delimiter_field(field, begin_sep_label='', end_sep_label='', begin_sep_field='', end_sep_field='') %}
  {% if field.id != 'csrf_token' %}
    {% if field.type == 'HiddenField' %}
      {{ field}}
    {% else %}
      {{begin_sep_label|safe}}
        <label for="{{field.id}}" control-label>
                    {{ field.label.text }}
                    {% if field.flags.required %}
                        <strong style="color: red">&#42;</strong>
                    {% endif %}
        </label>
      {{end_sep_label|safe}}
      {{begin_sep_field|safe}}
        {{ field(**kwargs)|safe }}
        <input class="form-control col-sm-9" style="margin: 10px 0px; display: none;" id="otherInput" name="otherInput" placeholder="Type your delimiter here" type="text" value="">
        <span class="help-block">{{ field.description }}</span>
    {% endif %}
    {% if field.errors %}
      <div class="alert alert-danger">
            {% for error in field.errors %}
              {{ _(error) }}
            {% endfor %}
      </div>
    {% endif %}
    {{end_sep_field|safe}}
  {% endif %}
{% endmacro %}

{% macro render_collapsable_form_group(id, section_title='') %}
  <div class="form-group" id="{{id}}">
    <div class="col-xs-12" style="padding: 0;">
      <table class="table table-bordered">
        <tbody>
          <tr data-toggle="collapse" data-target="#collapsable-content-{{id}}" class="accordion-toggle">
            <td class="col-xs-12" role="button" style="border: none;">
              <i class="fa fa-chevron-down" style="color: #666666; margin-right: 8px; margin-left: 12px;"></i>
              {{section_title}}
            </td>
          </tr>

          <tr class="collapse" id="collapsable-content-{{id}}">
            <td colspan="12" style="padding: 0;">
              <div>
                <table class="table table-bordered" style="margin-bottom: 0; background-color: transparent; border: none;">
                  <tbody>
                    {{ caller() }}
                  </tbody>
                </table>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
{% endmacro %}
